<template>
  <el-card header="查看" style="width: 1400px; margin: 0 auto">
    <template #header>
      <div class="header">
        <el-icon class="icon" size="20" @click="goBack"><ArrowLeft /></el-icon>
        <span>查看</span>
      </div>
    </template>
    <div class="content" v-loading="loading">
      <el-row
        :gutter="20"
        style="margin: 0; padding: 0; border: 1px solid #e9e9e9"
      >
        <el-col :span="10">
          <div class="info">
            <div class="info-label">标题</div>
            <div class="info-input">
              {{ detailInfo.title || '' }}
            </div>
          </div>
        </el-col>
        <el-col :span="14">
          <div class="info">
            <div class="info-label">发布机构</div>
            <div class="info-input">{{ detailInfo.org || '' }}</div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="info">
            <div class="info-label">发文字号</div>
            <div class="info-input">{{ detailInfo.documentNum || '' }}</div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="info">
            <div class="info-label">内容描述</div>
            <div class="info-input">
              {{ detailInfo.describes || '' }}
            </div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="info">
            <div class="info-label">佐证材料</div>
            <div class="info-input">
              <PreviewFile :tableData="detailInfo.files" />
            </div>
          </div>
        </el-col>
      </el-row>
      <div class="table">
        <div class="table-title">
          云阳县统计局2024年度统计“双随机”抽查名单及结果公示
        </div>
        <table>
          <thead>
            <tr>
              <td width="4%">序号</td>
              <td width="30%">抽查对象名称</td>
              <td width="10%">抽查时间</td>
              <td width="10%">组织形式</td>
              <td width="15%">执法检查信息</td>
              <td width="15%">处理情况</td>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>1</td>
              <td>云阳县盐化有限公司(云阳盐化有限公司新增云油五井)</td>
              <td>2024年5月18日</td>
              <td>“双随机”抽查</td>
              <td>未发现统计违法行为</td>
              <td>不许行政处罚，责令改正</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <div class="btns">
      <el-button type="primary"> 导出 </el-button>
      <el-button @click="goBack">返回</el-button>
    </div>
  </el-card>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { msgDetail, soptCheckDetail } from '@/api/spotCheck/spotCheck'
import { useRoute, useRouter } from 'vue-router'
import { ArrowLeft } from '@element-plus/icons-vue'
import { dateFormat } from '@/utils'
import PreviewFile from '@/views/spotCheck/components/previewFile/previewFile.vue'

const router = useRouter()

const route = useRoute()
const detailInfo = ref('')
const loading = ref(false)
onMounted(() => {
  loading.value = true
  msgDetail({ sorgResultPublicityId: route.query.id })
    .then((res) => {
      detailInfo.value = res.data
    })
    .finally(() => {
      loading.value = false
    })
})

//返回
const goBack = () => {
  router.go(-1)
}
</script>

<style scoped lang="scss">
.info {
  display: flex;
  margin-bottom: 20px;
  padding-top: 20px;
  .info-label {
    width: 108px;
    font-family: Source Han Sans SC, Source Han Sans SC;
    font-weight: 300;
    font-size: 18px;
    color: #666666;
    margin-right: 20px;
    display: inline-flex;
    justify-content: flex-end;
    align-items: center;
    height: 30px;
  }
  .info-input {
    flex: 1;
    font-family: Source Han Sans SC, Source Han Sans SC;
    font-weight: 400;
    font-size: 18px;
    color: #333333;
    line-height: 30px;
    min-width: 0;
  }
}

.upload {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.uploadListTable {
  border: 1px solid #e9e9e9;
}

:deep(.uploadListTable th) {
  background: #f5f6f8;
  font-weight: 300;
  font-size: 16px;
  color: #333333;
  height: 38px;
}

:deep(.el-col) {
  border-bottom: 1px solid #e9e9e9;
}

.table {
  width: 100%;
  padding: 50px 0;
  .table-title {
    font-weight: 500;
    font-size: 26px;
    color: #333333;
    text-align: center;
    margin-bottom: 30px;
  }

  table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 8px;
  }

  th,
  td {
    border: 1px solid #000;
    padding: 6px;
    height: 39px;
    text-align: center;
    font-size: 14px;
    :deep(.el-input) {
      --el-input-border-color: none;
      width: 100% !important;
    }
    :deep(.el-date-editor) {
      width: 90% !important;
    }
    :deep(.el-textarea__inner) {
      height: 100% !important;
    }
    .el-input-number {
      width: 100% !important;
    }
    :deep(.el-input__prefix-inner) {
      display: none;
    }
  }

  th {
    background-color: #f2f2f2;
  }
}
.btns {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 20px 20px 0;
  border-top: 1px solid #e9e9e9;
}
.select {
  width: 480px;
}
:deep(.el-card__body) {
  padding: 20px 0;
}
.content {
  width: 100%;
  box-sizing: border-box;
  padding: 0 30px;
}
.header {
  display: flex;
  align-items: center;
  .icon {
    margin-right: 16px;
    cursor: pointer;
  }
  span {
    font-family: Source Han Sans SC, Source Han Sans SC;
    font-weight: 500;
    font-size: 20px;
    color: #333333;
  }
}
</style>
